﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace XRM.Security.DataAccess.Models
{
    [Table("RequestWorkKind")]
    public class RequestWorkKind
    {
        public RequestWorkKind()
        {
            RequestWorkKindParams = new List<RequestWorkKindParam>();   
        }

        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int RequestWorkKindId { get; set; }
        
        [Required]
        public int RequestId { get; set; }
        [Required]
        public int WorkKindId { get; set; }

        public DateTime? CloseDate { get; set; }

        [ForeignKey("RequestId")]
        public virtual Request Request { get; set; }
        [ForeignKey("WorkKindId")]
        public virtual WorkKind WorkKind { get; set; }

        public virtual ICollection<RequestWorkKindParam> RequestWorkKindParams { get; set; }
    } 
}
